package com.oh.core.common.serializer;

import com.alibaba.fastjson2.JSON;
import com.oh.core.common.constant.SerializationAlgorithm;

public class JSONSerializationImpl implements Serializer{
    @Override
    public byte getSerializationAlgorithm() {
        return SerializationAlgorithm.FASTJSON;
    }

    @Override
    public byte[] serialization(Object object) {
        return JSON.toJSONBytes(object);
    }

    @Override
    public <T> T deserialization(Class<T> clazz, byte[] bytes) {
        return JSON.parseObject(bytes, clazz);
    }
}
